//
//  BiCarBorrowParser.m
//  TrunkIndustryManageSystem
//
//  Created by 李璐西 on 15-4-28.
//  Copyright (c) 2015年 李璐西. All rights reserved.
//

#import "BiCarBorrowParser.h"
#import "JSONKit.h"

#import "BiCarBorrowEntity.h"

@implementation BiCarBorrowParser
SINGLE_INSTANCE_IMPLEMENTION(BiCarBorrowParser)
//借车列表
+ (NSDictionary *)parserBorrowCarCheckListEntity:(NSString*)jsonStr{
//    NSLog(@"%@",jsonStr);
 
    NSDictionary *jsonDict = [jsonStr objectFromJSONStringWithParseOptions:JKParseOptionLooseUnicode];
    
    NSMutableArray * Array = [NSMutableArray array];
    
    id data =jsonDict[@"data"];
    
    if ([data isKindOfClass:[NSArray class]]) {
        
        for (NSDictionary * dic in data) {
            
//            NSLog(@"%@",dic);
            
            BiCarBorrowEntity  * entity = [[BiCarBorrowEntity alloc]init];
            
            entity.applyDate = GET_NOT_NULL_STRING(dic[@"applyDate"]);
            entity.applyPersonPerformance = GET_NOT_NULL_STRING(dic[@"applyPersonPerformance"]);
            entity.borrowCarPersonId = GET_NOT_NULL_STRING(dic[@"borrowCarPersonId"]);
            entity.borrowCarPersonName = GET_NOT_NULL_STRING(dic[@"borrowCarPersonName"]);
            entity.carId = GET_NOT_NULL_STRING(dic[@"carId"]);
            entity.driverId = GET_NOT_NULL_STRING(dic[@"driverId"]);
            entity.driverName = GET_NOT_NULL_STRING(dic[@"driverName"]);
            entity.driverPreformance = GET_NOT_NULL_STRING(dic[@"driverPreformance"]);
            entity.e_id = GET_NOT_NULL_STRING(dic[@"id"]);
            entity.jcApproveDate = GET_NOT_NULL_STRING(dic[@"jcApproveDate"]);
            entity.jcApprovePersonId = GET_NOT_NULL_STRING(dic[@"jcApprovePersonId"]);
            entity.jcApprovePersonName = GET_NOT_NULL_STRING(dic[@"jcApprovePersonName"]);
            entity.jcRejectReasons = GET_NOT_NULL_STRING(dic[@"jcRejectReasons"]);
            entity.jcResaon = GET_NOT_NULL_STRING(dic[@"jcResaon"]);
            entity.returnCarDate = GET_NOT_NULL_STRING(dic[@"returnCarDate"]);
            entity.storeroomMangerId = GET_NOT_NULL_STRING(dic[@"storeroomMangerId"]);
            entity.storeroomMangerName = GET_NOT_NULL_STRING(dic[@"storeroomMangerName"]);
            entity.storeroomMangerPreformance = GET_NOT_NULL_STRING(dic[@"storeroomMangerPreformance"]);
            entity.sumPerformance = GET_NOT_NULL_STRING(dic[@"sumPerformance"]);
            entity.totalNum = GET_NOT_NULL_STRING(dic[@"totalNum"]);
            entity.vin = GET_NOT_NULL_STRING(dic[@"vin"]);
            
 
            [Array addObject:entity];
        }
    }
    
       return [NSDictionary dictionaryWithObjectsAndKeys:jsonDict[@"response_status"],@"response_status",jsonDict[@"result_info"],@"result_info",Array,@"data", nil];
}
//获取借车审批
+ (NSDictionary *)parserBorrowCarCheckEntity:(NSString *)jsonStr{
    //    NSLog(@"%@",jsonStr);
    
    NSDictionary *jsonDict = [jsonStr objectFromJSONStringWithParseOptions:JKParseOptionLooseUnicode];
    
    NSMutableArray * Array = [NSMutableArray array];
    
    id data =jsonDict[@"data"];
    
    if ([data isKindOfClass:[NSArray class]]) {
        
        for (NSDictionary * dic in data) {
            
            //            NSLog(@"%@",dic);
            
            BiCarBorrowEntity  * entity = [[BiCarBorrowEntity alloc]init];
            
            entity.responseStatus = GET_NOT_NULL_STRING(dic[@"response_status"]);
            entity.resultinfo = GET_NOT_NULL_STRING(dic[@"result_info"]);
//            entity.data = GET_NOT_NULL_STRING(dic[@"data"]);
            
            [Array addObject:entity];

        }
    }
    
    return [NSDictionary dictionaryWithObjectsAndKeys:jsonDict[@"response_status"],@"response_status",jsonDict[@"result_info"],@"result_info",Array,@"data", nil];
    
}
//还车列表
+ (NSDictionary *)parserCarReturnCheckListEntity:(NSString*)jsonStr{
        NSLog(@"%@",jsonStr);
    
    NSDictionary *jsonDict = [jsonStr objectFromJSONStringWithParseOptions:JKParseOptionLooseUnicode];
    
    NSMutableArray * Array = [NSMutableArray array];
    
    id data =jsonDict[@"data"];
    
    if ([data isKindOfClass:[NSArray class]]) {
        
        for (NSDictionary * dic in data) {
            
//                        NSLog(@"%@",dic);
            
            BiCarBorrowEntity  * entity = [[BiCarBorrowEntity alloc]init];
            
            entity.applyDate = GET_NOT_NULL_STRING(dic[@"applyDate"]);
            entity.applyPersonPerformance = GET_NOT_NULL_STRING(dic[@"applyPersonPerformance"]);
            entity.borrowCarPersonId = GET_NOT_NULL_STRING(dic[@"borrowCarPersonId"]);
            entity.borrowCarPersonName = GET_NOT_NULL_STRING(dic[@"borrowCarPersonName"]);
            entity.carId = GET_NOT_NULL_STRING(dic[@"carId"]);
            entity.driverId = GET_NOT_NULL_STRING(dic[@"driverId"]);
            entity.driverName = GET_NOT_NULL_STRING(dic[@"driverName"]);
            entity.driverPreformance = GET_NOT_NULL_STRING(dic[@"driverPreformance"]);
            entity.e_id = GET_NOT_NULL_STRING(dic[@"id"]);
            entity.jcApproveDate = GET_NOT_NULL_STRING(dic[@"jcApproveDate"]);
            entity.jcApprovePersonId = GET_NOT_NULL_STRING(dic[@"jcApprovePersonId"]);
            entity.jcApprovePersonName = GET_NOT_NULL_STRING(dic[@"jcApprovePersonName"]);
            entity.jcRejectReasons = GET_NOT_NULL_STRING(dic[@"jcRejectReasons"]);
            entity.jcResaon = GET_NOT_NULL_STRING(dic[@"jcResaon"]);
            entity.returnCarDate = GET_NOT_NULL_STRING(dic[@"returnCarDate"]);
            entity.storeroomMangerId = GET_NOT_NULL_STRING(dic[@"storeroomMangerId"]);
            entity.storeroomMangerName = GET_NOT_NULL_STRING(dic[@"storeroomMangerName"]);
            entity.storeroomMangerPreformance = GET_NOT_NULL_STRING(dic[@"storeroomMangerPreformance"]);
            entity.sumPerformance = GET_NOT_NULL_STRING(dic[@"sumPerformance"]);
            entity.totalNum = GET_NOT_NULL_STRING(dic[@"totalNum"]);
            entity.vin = GET_NOT_NULL_STRING(dic[@"vin"]);
            
            entity.hcCheckDate = GET_NOT_NULL_STRING(dic[@"hcCheckDate"]);
            entity.hcHandlerName = GET_NOT_NULL_STRING(dic[@"hcHandlerName"]);
            entity.hcHandlerId = GET_NOT_NULL_STRING(dic[@"hcHandlerId"]);
            entity.hcApprovePersonId = GET_NOT_NULL_STRING(dic[@"hcApprovePersonId"]);
            entity.hcRejecctReason = GET_NOT_NULL_STRING(dic[@"hcRejecctReason"]);
            entity.hcApproveDate = GET_NOT_NULL_STRING(dic[@"hcApproveDate"]);
            entity.hcRejectReasons = GET_NOT_NULL_STRING(dic[@"hcRejectReasons"]);
            [Array addObject:entity];
        }
    }
    
    return [NSDictionary dictionaryWithObjectsAndKeys:jsonDict[@"response_status"],@"response_status",jsonDict[@"result_info"],@"result_info",Array,@"data", nil];
}
//获取还车审批
+ (NSDictionary *)parserCarReturnCheckEntity:(NSString *)jsonStr{
    //    NSLog(@"%@",jsonStr);
    
    NSDictionary *jsonDict = [jsonStr objectFromJSONStringWithParseOptions:JKParseOptionLooseUnicode];
    
    NSMutableArray * Array = [NSMutableArray array];
    
    id data =jsonDict[@"data"];
    
    if ([data isKindOfClass:[NSArray class]]) {
        
        for (NSDictionary * dic in data) {
            //            NSLog(@"%@",dic);
            
            BiCarBorrowEntity  * entity = [[BiCarBorrowEntity alloc]init];
            
            entity.responseStatus = GET_NOT_NULL_STRING(dic[@"response_status"]);
            entity.resultinfo = GET_NOT_NULL_STRING(dic[@"result_info"]);
            //            entity.data = GET_NOT_NULL_STRING(dic[@"data"]);
            //            NSLog(@"%@",dic);
            
           
//            entity.responseStatus = GET_NOT_NULL_STRING(dic[@"response_status"]);
//            entity.resultinfo = GET_NOT_NULL_STRING(dic[@"result_info"]);
//            //            entity.data = GET_NOT_NULL_STRING(dic[@"data"]);
//            
//            entity.hcCheckDate = GET_NOT_NULL_STRING(dic[@"hcCheckDate"]);
//            entity.hcHandlerName = GET_NOT_NULL_STRING(dic[@"hcHandlerName"]);
//            entity.hcHandlerId = GET_NOT_NULL_STRING(dic[@"hcHandlerId"]);
//            entity.hcApprovePersonId = GET_NOT_NULL_STRING(dic[@"hcApprovePersonId"]);
//
//            entity.hcRejectReasons = GET_NOT_NULL_STRING(dic[@"hcRejectReasons"]);
            
            [Array addObject:entity];
        }
    }
    
    return [NSDictionary dictionaryWithObjectsAndKeys:jsonDict[@"response_status"],@"response_status",jsonDict[@"result_info"],@"result_info",Array,@"data", nil];
    
}
@end
